package com.cust.cow.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cust.cow.pojo.pill;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Mapper
public interface PillMapper extends BaseMapper<pill> {
    //查找全部的药品
    @Select("select * from pill")
    public List<pill> findPillAll();

    //按照名臣查找
    @Select("select * from pill where pill_id = #{pillId}")
    public pill findPillByName(Integer pillId);

    @Insert("insert into pill(pill_name, function) values(#{pillName}, #{function})")
    public int insertPill(@RequestBody pill pill);

    @Delete("delete from pill where pill_id = #{pillId}")
    public int deletePill(Integer pillId);
}
